// 上传图片
const Authorization = uni.getStorageSync("Mtoken")
export function uploadFile(files) {
  var p = new Promise(function (resolve, reject) {
    var url = 'https://bootapi.51bmj.cn/bmj-api/api/cms/businessPlanEvaluation/evaluationBusinessPlan';
    var xhr = new XMLHttpRequest();
    xhr.open('POST', url, true);
    xhr.onload = function () {
      // 请求完成
      var data = JSON.parse(xhr.responseText);
      if (this.status === 200) {       
        if (data.success == true) {
          resolve(data);
        } else {
          resolve(data);
        }
      } else {
        resolve('上传失败');
      }
    };
    var formdata = new FormData();
    formdata.append('file', files);
    xhr.setRequestHeader('X-Access-Token', Authorization);
    xhr.send(formdata);
  });
  return p;
}